From aa04e2b9f63aae953040816306a45bdf86a2195f Mon Sep 17 00:00:00 2001
From: Leah Rowe <info@minifree.org>
Date: Thu, 22 Feb 2024 17:52:03 +0000
Subject: [PATCH 1/1] nb/haswell: disable igpu when dgpu is used

normally, this is done with haswell mrc, which handles
that, but when using broadwell, the igpu is not disabled,
and legacy vga cycles are not routed to the dgpu

add this behaviour in gma.g for broadwell mrc.bin

tested on dell optiplex 9020 sff

Signed-off-by: Leah Rowe <info@minifree.org>
---
 src/northbridge/intel/haswell/gma.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/northbridge/intel/haswell/gma.c b/src/northbridge/intel/haswell/gma.c
index 6e6948b70f..ee4d321261 100644
--- a/src/northbridge/intel/haswell/gma.c
+++ b/src/northbridge/intel/haswell/gma.c
@@ -461,12 +461,21 @@ static void gma_generate_ssdt(const struct device *dev)
 	drivers_intel_gma_displays_ssdt_generate(&chip->gfx);
 }
 
+static void gma_func0_disable(struct device *dev)
+{
+	/* Disable VGA decode */
+	pci_or_config16(pcidev_on_root(0, 0), GGC, 1 << 1);
+
+	dev->enabled = 0;
+}
+
 static struct device_operations gma_func0_ops = {
 	.read_resources		= pci_dev_read_resources,
 	.set_resources		= pci_dev_set_resources,
 	.enable_resources	= pci_dev_enable_resources,
 	.init			= gma_func0_init,
 	.acpi_fill_ssdt		= gma_generate_ssdt,
+	.vga_disable            = gma_func0_disable,
 	.ops_pci		= &pci_dev_ops_pci,
 };
 
-- 
2.39.2

